package com.lixin.springcloud.service;

import com.lixin.springcloud.entities.CommonResult;
import com.lixin.springcloud.entities.Payment;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;

// 去EurekaServer中寻找名称为CLOUD-PAYMENT-SERVICE的服务，具体调用哪个实例，由OpenFeign的负载均衡算法决定
@Component
@FeignClient("CLOUD-PAYMENT-SERVICE")
//@FeignClient("CLOUD-HYSTIRX-PAYMENT-SERVICE")
public interface OpenFeignPaymentService {

    @GetMapping("/payment/get/{id}")
    public CommonResult<Payment> getPaymentById(@PathVariable("id") Long id);

    @GetMapping("/payment/timeout")
    public String paymentTestTimeout();

    @GetMapping("/payment/zipkin")
    public String paymentZipkin();

}
